<?

/*
	Puddle - mini-microblog and lifestreaming 
		(based on pidiblog (c)2008 Jindrich Skacel
*/

	// include config, languages file and system functions
	require_once("puddle/config.php");
	require_once($blogRoot."functions.php");


	if ($loggedIn) {
		// if we want insert message
		if($_POST["submit"]==$lang["submit_insert"]) {
			addTweet();
		}
	}


	/* link the theme functions */
	if ($theme)	require_once($blogRoot."themes/".$theme."/functions.php");
	require_once($blogRoot."themes/_system/pageheader.php");
	
	

	/* link in the theme-header */
	require_once($blogRoot."themes/".$theme."/header.php");


	//$msg=Messages("",$lang,$msg,$err);
	$action=Actions();


	/* display About page? */
	if ($_GET["about"]) {
		include($blogRoot."about.php");
	} else {
		

			if ($install_completed && function_exists('drawProfile')) drawProfile();
?>		
			
			<div id="post">
<? 



				
					if (!IsSet($_GET["cmt"])) {
						echo $action; 
					}

					/* Display a specific tweet-post ? */
					if(IsSet($_GET["cmt"])) {
						echo loadTweet($_GET["cmt"]);
						
						/* Display the comments, using disqus */
						if(enableComments) {
							print '<div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/'.$disqusname.'/embed.js"></script><noscript><a href="http://'.$disqusname.'.disqus.com/?url=ref">View the discussion thread.</a></noscript>';
						}
					} else if (IsSet($_GET["archive"])) {
						print loadTweets(0,$_GET["archive"]);
					} else {
						print "<br/>";
						if (isset($_GET["page"])) $page=$_GET["page"];
						else $page=1;
						print loadTweets($page);
					}
?>
			</div>
<?
		}

			require_once($blogRoot."themes/".$theme."/footer.php");		
			require_once($blogRoot."themes/_system/pagefooter.php");		
?>
